<?php
class View extends Object
{
	private $array_variables;
	private $file_name;
	private $security;
	
	public function __construct($file_name)
	{
		$template = Helper::instance('Template');
		$this->file_name = $template->getfile($file_name);
		$this->array_variables = array();
		$this->security = helper::instance('Security');
	}
	
	public function assign($var_name, $var_value)
	{
		$this->array_variables[$var_name] = $var_value;
	}
	
	public function render($print=false)
	{
		$output = $this->load();
		
		return $output;
	}
	
	private function load()
	{
		//die(var_dump($this->array_variables));
		ob_start();
		extract($this->array_variables);
		include($this->file_name);
		
		return ob_get_clean();
	}
	
	public function __set( $var_name, $var_value )
	{
		$this->array_variables[$var_name] = $var_value;
	}
	
	public function __toString()
	{
		return $this->render();
	}
}
?>